HAL DAC migration: List of applicable concepts ¶
This section provides information about the HAL DAC applicable architecture concepts.
Concepts for DAC ¶
|
Concept |
Description |
|---|---|
|
The Init has been split into two functions :
|
|
|
Removal and conversion of init structure to configuration structure |
The init structure has been removed and moved to the
|
|
The handle structure has been renamed to
|
|
|
|
|
|
New APIs are available to get and set DAC features. |
|
|
Provide
|
|
|
Two functions to set and get user data are available:
|
|
|
Individual callback registration APIs replace global register and unregister functions |
The callback registration is handled by specific functions for each DAC event. These functions are used to register callback functions for different DAC events. |
|
HAL DAC APIs now rely on LL APIs rather than performing direct register access. |
|
|
Define statements and enumerations redirected to LL equivalents |
HAL DAC define statements and enumerations are based on LL define statements. |
|
All hardware macros have been removed from the HAL DAC driver, and equivalent services are ensured through the LL APIs. |
|
|
The DAC state machine now is split into:
|
|
|
The HAL DAC functions were updated to return:
|
|
|
The HAL error handling mechanisms have been redesigned to improve the detection, reporting, and handling of errors. This provides more detailed and consistent error information. |
|
|
New APIs for filtering optional asynchronous process interrupts |
New APIs are provided in the HAL DAC to filter and manage asynchronous process interrupts :
|
|
All TypeDef parts of the HAL DAC driver have been removed and replaced by
|
|
|
Const keywords have been added to non-modifiable pointers to ensure that either the pointer itself or the data it points to cannot be modified. This enhances code safety and readability, prevents unintended modifications, and renders code more robust and maintainable. |
|
|
The parameters and state are checked using
|
|
|
Merge HAL extension files with common ones and remove the EX prefix from APIs. |
Only one HAL DAC header file remains and all macros, define statements, and functions from
|
|
Add HAL PPP Services for Drivers with Handle to Retrieve Corresponding Peripheral Clock Frequency. |
HAL DAC provides new API to retrieve clock frequency
|
|
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels. |
Finite parameters (including DAC instances) have been converted into enumerated types (enums) at HAL level. This improves code readability, maintainability, and type safety. |
|
Change Channel Argument to 0-Based Enumeration in Timer Channels |
The HAL channels are now represented as an incremental 0-based enumeration. |
|
In HAL2, the implementation of
|
|
|
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions). |
All HAL DAC functions start with
|
Other HAL DAC changes ¶
|
Concept |
Consideration |
|---|---|
|
Change API to set:
|
HAL1: #define DAC_CHIPCONNECT_EXTERNAL
#define DAC_CHIPCONNECT_INTERNAL
#define DAC_CHIPCONNECT_BOTH
HAL2: typedef enum
{
HAL_DAC_OUTPUT_CONNECTION_EXTERNAL = LL_DAC_OUTPUT_CONNECT_GPIO,
HAL_DAC_OUTPUT_CONNECTION_INTERNAL = LL_DAC_OUTPUT_CONNECT_INTERNAL
} hal_dac_output_connection_t;
Note DAC_CHIPCONNECT_BOTH was removed: In HAL2, the equivalent is HAL_DAC_OUTPUT_CONNECTION_INTERNAL, as long as the DAC output buffer mode is configured HAL_DAC_OUTPUT_BUFFER_ENABLED. |